require.config({
                baseUrl:"../",
	paths:{
		bsl:'bsl',

	}
});
require(['bsl'],function(bsl){
	document.addEventListener('deviceready', onDeviceready, false);
  
        function onDeviceready(){
        // alert("star");
        
        var button = document.getElementById("button1");
        var button2 = document.getElementById("button2");

        function picture(){
          var cmr = bsl.camera.getCamera();

           cmr.captureImage(
           function(imageURI){
             setTimeout(function() {
                 alert("image :" + imageURI);
             }, 0);

                 var largeImage = document.getElementById('smallImage');

                 largeImage.style.display = 'block';

                 largeImage.src = imageURI;
           },
           function(error){
                   alert("message:" + error.message);
           },
           {
                 format  : "png",
                 index   : 1,
                 popover : {
                   top: "100",
                   left: "33%",
                   width: "33%",
                   height:"100"
                 },
                 shouldSaveToPhotoAlbum: true,

           });
        }

        function video(){
           var cmr = bsl.camera.getCamera();
           cmr.startVideoCapture(
            function(path){
              alert(path);
            },function(error){
              alert(error.code + " " + error.message);
            },{});
        }

        button.onclick = picture;
        button2.onclick = video;
      }
        
});